package _3_abstract_factory

import "fmt"

//抽象动物
type Animal interface {
	show()
}

//马类
type  Horse struct {

}

func (self *Horse)show(){
	fmt.Println("千里马")
}

//牛类
type Cattle struct {

}

func (self *Cattle)show(){
	fmt.Println("五彩神牛")
}

//植物类抽象
type Plant interface {
	show1()
}

//水果类
type Fruitage struct {

}

func (self *Fruitage)show1()  {
	fmt.Println("苹果，香蕉")
}

type Vegetables struct {

}

func (self *Vegetables)show1()  {
	fmt.Println("黄瓜，西红柿")
}

type Farm interface {
	newAnimal() Animal
	newPlant() Plant
}


type SGFarm struct {
	
}

func (self *SGFarm)newAnimal()  Animal{

	return &Horse{}
}
func (self *SGFarm)newPlant()  Plant{
	return &Vegetables{}
}


type SRFarm struct {

}

func (self *SRFarm)newAnimal()  Animal{
	return &Cattle{}
}

func (self *SRFarm)newPlant()Plant{
	return &Fruitage{}
}